# 剧本的关键：目标主机、目标事件
# 需要对二者做关联，在这里设计一个引擎，将任务分发到主机并执行

from concurrent.futures import ThreadPoolExecutor

class ExecutionEngine:
    def __init__(self):
        self.hosts = []
        self.tasks = []
    # 向上方hosts添加主机信息
    def add_host(self, host):
        self.hosts.append(host)
    #  向上方 tasks 添加任务信息
    def add_task(self, task):
        self.tasks.append(task)
    
    def run(self): # 设计并发执行：连接和任务发布执行
       with ThreadPoolExecutor() as executor:
           futures = []
           for host in self.hosts:
               for task in self.tasks:
                   future = executor.submit(task.execute, host)
                   futures.append(future)
            
            for future in futures
    
    